

**************************************************************TABLE 1, TABLES A1/A2/A3**************************************************************

*******
*BOONE*
*******
global out outreg2 using "$OUT/Tables_A1_1",  rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2),"Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel 

use "$DATA/tenyr_final_pub", clear

booneprep

global boone lngni_relOECD lngni_relOECD2 gnipcrg popg totfullchg_gain paris ssa asia lac
global period _Iperiod_3  

global if if boone_base_country==1
qui reg gK_gni netoda_gni $boone $period $if, r cl(ccode)
$out replace			/* Placeholder to fill out Boone published result */							
$out append

global if if boone_full_country==1
qui ivreg2 gK_gni (netoda_gni=lnpop friendOPEC friendUS francz) $boone $period $if, r cl(ccode) small
$out append			/* Placeholder to fill out netoda_gdp estimate in Boone published result */
$out append			

qui ivreg2 gK_gni (netoda_gni=friendOPEC friendUS francz) lnpop $boone $period $if, r cl(ccode) small
$out append		

*******************
*BURNSIDE & DOLLAR*
*******************

global period _Iperiod_3 _Iperiod_4 _Iperiod_5 _Iperiod_6 _Iperiod_7
global if if bdsamp==1 & periodst>=1970 & periodst<=1990

use "$DATA/bb_final_pub",clear

global out outreg2 using "$OUT/Tables_A2_1",  rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2),"Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel 

global y bdgdpg
global x bdlgdp bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 bdpolicy _Iperiod* 
global z bdfrz bdcentam bdegypt bdarms1 bdarms1policy bdlgdppolicy bdlgdp2policy bdlpoppolicy bdlpop2policy bdlpop

qui ivreg2 $y $x (bdedar=$z) $if, robust ffirst
$out replace			/* Placeholder to fill out published result */
$out append

qui ivreg2 $y $x (bdedar=bdcentam bdegypt bdarms1 bdarms1policy bdlgdppolicy bdlgdp2policy) bdlpoppolicy bdlpop2policy bdlpop $if, robust ffirst
$out append

qui ivreg2 $y $x (bdedar=bdcentam bdegypt bdarms1) bdarms1policy bdlgdppolicy bdlgdp2policy bdlpoppolicy bdlpop2policy bdlpop $if, robust ffirst
$out append


*********************
*RAJAN & SUBRAMANIAN*
*********************

use "$DATA/stage1&2_pub", clear

global out outreg2 using "$OUT/Tables_A3_1",  rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2),"Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel 

global rs yc_penn sw1 le_wdi geog6099 gadp6099 Inf5_ES M2_GDP5_ES BB_GDP5_WDI revol ethfrac_pap safrica east

qui ivreg2 rgdpchg (aid_gdp=Faid_gdp) $rs if period=="1970_00", r first small
$out replace			/* Placeholder to fill out published result */
$out append

qui ivreg2 rgdpchg (aid_gdp=Faid_gdp) logpop $rs if period=="1970_00",r first small
$out append


**************************************************************BOONE: TABLE 4/5**************************************************************

use "$DATA/tenyr_final_pub", clear
booneprep

gen lnetoda_gni = l.netoda_gni
gen lnetoda_gni2 = l.netoda_gni2
gen dlnetoda_gni = d.l.netoda_gni
gen dlnetoda_gni2 = d.l.netoda_gni2
gen learlyaidC_gni = l.earlyaidC_gni
gen learlyaidC_gni2 = l.earlyaidC_gni2
gen dlearlyaidC_gni = d.l.earlyaidC_gni
gen dlearlyaidC_gni2 = d.l.earlyaidC_gni2
gen lrepay_gni = l.repay_gni
gen lrepay_gni2 = l.repay_gni2
gen dlrepay_gni = d.l.repay_gni
gen dlrepay_gni2 = d.l.repay_gni2

global boone lngni_relOECD lngni_relOECD2 gnipcrg popg totfullchg_gain paris ssa asia lac

***SUMMARY STATS***
log using "$OUT/sumstats", text replace
tabstat netoda_gni gK_gni if bsamp_full & (period==2 | period==3 | period==4), stat(N mean median sd min max)
tabstat netoda_gni gK_gni if boone_full_country & (period==2 | period==3), stat(N mean median sd min max)
log c

******************************
***1. Original Years Sample***
******************************
global out outreg2 using "$OUT/Table_4", rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
global if if boone_full_country==1
global period _Iperiod_3 
scalar turnpt = 0
scalar deltaSE = 0

*1
qui reg gK_gni netoda_gni $boone $period if boone_base_country==1, r cl(ccode)
$out replace

*2
qui ivreg2 gK_gni (netoda_gni=friendOPEC friendUS francz lnpop) $boone $period if boone_base_country==1, r cl(ccode) small
$out append

*3
qui reg gK_gni netoda_gni $boone $period $if, r cl(ccode)
$out append

*4
qui ivreg2 gK_gni (netoda_gni=friendOPEC friendUS francz lnpop) $boone $period $if, r cl(ccode) small
$out append

*5
qui reg gK_gni l.netoda_gni $boone $period $if,r cl(ccode)
qui reg gK_gni netoda_gni $boone $period $if & e(sample), r cl(ccode)
$out append

*6
qui reg gK_gni l.netoda_gni $boone $period $if,r cl(ccode)
$out append

*7
qui reg d.(gK_gni l.netoda_gni $boone) $period $if,r cl(ccode)
qui reg gK_gni netoda_gni $boone $period $if & e(sample), r cl(ccode)
$out append

*8
qui reg d.(gK_gni l.netoda_gni $boone) $period $if,r cl(ccode)
$out append

*9
* significance of the turning point
qui reg gK_gni lnetoda_gni lnetoda_gni2 $boone $period $if,r cl(ccode)
scalar turnpt = -_b[lnetoda_gni]/(2*_b[lnetoda_gni2])
nlcom -_b[lnetoda_gni]/(2*_b[lnetoda_gni2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gK_gni l.(netoda_gni netoda_gni2) $boone $period $if,r cl(ccode)
qui sum l.netoda_gni if e(sample)
local muaid=r(mean)
qui reg gK_gni l.(netoda_gni netoda_gni2) $boone $period $if,r cl(ccode)
* joint significance at the mean value of aid
lincom _b[l.netoda_gni]*`muaid'+_b[l.netoda_gni2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*10
* significance of the turning point
qui reg d.gK_gni dlnetoda_gni dlnetoda_gni2 d.($boone) $period $if,r cl(ccode)
scalar turnpt = -_b[dlnetoda_gni]/(2*_b[dlnetoda_gni2])
nlcom -_b[dlnetoda_gni]/(2*_b[dlnetoda_gni2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gK_gni l.netoda_gni l.netoda_gni2 $boone) $period $if,r cl(ccode)
qui sum d.l.netoda_gni if e(sample)
local muaid=r(mean)
qui reg d.(gK_gni l.netoda_gni l.netoda_gni2 $boone) $period $if,r cl(ccode)
* joint significance at the mean value of aid
lincom _b[d.l.netoda_gni]*`muaid'+_b[d.l.netoda_gni2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*11
* significance of the turning point
qui reg gK_gni learlyaidC_gni learlyaidC_gni2 lrepay_gni lrepay_gni2 $boone $period $if,r cl(ccode)
scalar turnpt = -_b[learlyaidC_gni]/(2*_b[learlyaidC_gni2])
nlcom -_b[learlyaidC_gni]/(2*_b[learlyaidC_gni2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gK_gni l.(earlyaidC_gni earlyaidC_gni2 repay_gni repay_gni2) $boone $period $if,r cl(ccode)
qui sum l.earlyaidC_gni if e(sample)
local muaid=r(mean)
qui reg gK_gni l.(earlyaidC_gni earlyaidC_gni2 repay_gni repay_gni2) $boone $period $if,r cl(ccode)
* joint significance at the mean value of aid
lincom _b[l.earlyaidC_gni]*`muaid'+_b[l.earlyaidC_gni2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


******************************
***2. Extended Years Sample***
******************************
global out outreg2 using "$OUT/Table_5", rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
global if if bsamp_full==1 
global period _Iperiod_3 _Iperiod_4 
scalar turnpt = 0
scalar deltaSE = 0

*1
qui reg gK_gni netoda_gni $boone $period if bsamp_base==1, r cl(ccode)
$out replace

*2
qui ivreg2 gK_gni (netoda_gni=friendOPEC friendUS francz lnpop) $boone $period if bsamp_base==1, r cl(ccode) small
$out append

*3
qui reg gK_gni netoda_gni $boone $period $if, r cl(ccode)
$out append

*4
qui ivreg2 gK_gni (netoda_gni=friendOPEC friendUS francz lnpop) $boone $period $if, r cl(ccode) small
$out append

*5
qui reg gK_gni l.netoda_gni $boone $period $if,r cl(ccode)
qui reg gK_gni netoda_gni $boone $period $if & e(sample), r cl(ccode)
$out append

*6
qui reg gK_gni l.netoda_gni $boone $period $if & e(sample),r cl(ccode)
$out append

*7
qui reg d.(gK_gni l.netoda_gni $boone) $period $if,r cl(ccode)
qui reg gK_gni netoda_gni $boone $period $if & e(sample), r cl(ccode)
$out append

*8
qui reg d.(gK_gni l.netoda_gni $boone) $period $if & e(sample),r cl(ccode)
$out append

*9
* significance of the turning point
qui reg gK_gni lnetoda_gni lnetoda_gni2 d.($boone) $period $if,r cl(ccode)
scalar turnpt = -_b[lnetoda_gni]/(2*_b[lnetoda_gni2])
nlcom -_b[lnetoda_gni]/(2*_b[lnetoda_gni2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gK_gni l.(netoda_gni netoda_gni2) $boone $period $if,r cl(ccode)
qui sum l.netoda_gni if e(sample)
local muaid=r(mean)
qui reg gK_gni l.(netoda_gni netoda_gni2) $boone $period $if,r cl(ccode)
* joint significance at the mean value of aid
lincom _b[l.netoda_gni]*`muaid'+_b[l.netoda_gni2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*10
* significance of the turning point
qui reg d.gK_gni dlnetoda_gni dlnetoda_gni2 d.($boone) $period $if,r cl(ccode)
scalar turnpt = -_b[dlnetoda_gni]/(2*_b[dlnetoda_gni2])
nlcom -_b[dlnetoda_gni]/(2*_b[dlnetoda_gni2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gK_gni l.netoda_gni l.netoda_gni2 $boone) $period $if,r cl(ccode)
qui sum d.l.netoda_gni if e(sample)
local muaid=r(mean)
qui reg d.(gK_gni l.netoda_gni l.netoda_gni2 $boone) $period $if,r cl(ccode)
* joint significance at the mean value of aid
lincom _b[d.l.netoda_gni]*`muaid'+_b[d.l.netoda_gni2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*11
* significance of the turning point
qui reg gK_gni learlyaidC_gni learlyaidC_gni2 lrepay_gni lrepay_gni2 $boone $period $if,r cl(ccode)
scalar turnpt = -_b[learlyaidC_gni]/(2*_b[learlyaidC_gni2])
nlcom -_b[learlyaidC_gni]/(2*_b[learlyaidC_gni2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gK_gni l.(earlyaidC_gni earlyaidC_gni2 repay_gni repay_gni2) $boone $period $if,r cl(ccode)
qui sum l.earlyaidC_gni if e(sample)
local muaid=r(mean)
qui reg gK_gni l.(earlyaidC_gni earlyaidC_gni2 repay_gni repay_gni2) $boone $period $if,r cl(ccode)
* joint significance at the mean value of aid
lincom _b[l.earlyaidC_gni]*`muaid'+_b[l.earlyaidC_gni2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*12
* significance of the turning point
qui reg d.gK_gni dlearlyaidC_gni dlearlyaidC_gni2 dlrepay_gni dlrepay_gni2 d.($boone) $period $if,r cl(ccode)
scalar turnpt = -_b[dlearlyaidC_gni]/(2*_b[dlearlyaidC_gni2])
nlcom -_b[dlearlyaidC_gni]/(2*_b[dlearlyaidC_gni2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gK_gni l.earlyaidC_gni l.earlyaidC_gni2 l.repay_gni l.repay_gni2 $boone) $period $if,r cl(ccode)
qui sum d.l.earlyaidC_gni if e(sample)
local muaid=r(mean)
qui reg d.(gK_gni l.earlyaidC_gni l.earlyaidC_gni2 l.repay_gni l.repay_gni2 $boone) $period $if,r cl(ccode)
* joint significance at the mean value of aid
lincom _b[d.l.earlyaidC_gni]*`muaid'+_b[d.l.earlyaidC_gni2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


**************************************************************Burnside & Dollar: TABLE 6/7**************************************************************

******************************
***1. Original Years Sample***
******************************

global out outreg2 using "$OUT/Table_6", rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
global if if bdsamp==1 & periodst>=1970 & periodst<=1990
scalar deltaSE=0
scalar turnpt=0

//OLS
use "$DATA/fouryr_final_pub",clear

cap rename policy_newper _policy_newper
cap rename policy_oldper _policy_oldper

tsset ccode period
aidstat

global bd bdlgdp bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 
global ivs bdarms1policy bdlgdppolicy bdlgdp2policy bdlpoppolicy bdlpop2policy bdlpop
global period _Iperiod_3 _Iperiod_4 _Iperiod_5 _Iperiod_6 _Iperiod_7

gen lnetoda_gdp = l.netoda_gdp
gen lnetoda_gdp2 = l.netoda_gdp2
gen dlnetoda_gdp = d.l.netoda_gdp
gen dlnetoda_gdp2 = d.l.netoda_gdp2
gen learlyaidC_gdp = l.earlyaidC_gdp
gen learlyaidC_gdp2 = l.earlyaidC_gdp2
gen dlearlyaidC_gdp = d.l.earlyaidC_gdp
gen dlearlyaidC_gdp2 = d.l.earlyaidC_gdp2
gen lrepay_gdp = l.repay_gdp
gen lrepay_gdp2 = l.repay_gdp2
gen dlrepay_gdp = d.l.repay_gdp
gen dlrepay_gdp2 = d.l.repay_gdp2

***SUMMARY STATS***
log using "$OUT/sumstats", text append
tabstat netoda_gdp bdgdpg if bdsamp & (period>=2 & period<=7), stat(N mean median sd min max)
tabstat netoda_gdp gdppcg if period>=2 & bdsamp, stat(N mean median sd min max)
log c

*1
qui reg bdgdpg l.netoda_gdp $bd bdinfl bdbb bdsacw $period $if, r
policyo
qui reg bdgdpg l.netoda_gdp $bd policy_oldper $period $if,r
qui reg bdgdpg netoda_gdp $bd policy_oldper $period $if & e(sample),r
$out replace

*2
qui reg bdgdpg l.netoda_gdp $bd policy_oldper $period $if,r
$out append

*3
qui reg d.(bdgdpg l.netoda_gdp $bd policy_oldper) $period $if,r
qui reg bdgdpg netoda_gdp $bd policy_oldper $period $if & e(sample),r
$out append

*4
qui reg d.(bdgdpg l.netoda_gdp $bd policy_oldper) $period $if,r
$out append
 
*5
qui ivreg2 d.bdgdpg (d.bdlgdp=d.l.bdlgdp) d.(l.netoda_gdp bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 policy_oldper) $period $if, r ffirst
$out append

*6
qui reg bdgdpg l.(netoda_gdp netoda_gdp2) $bd bdinfl bdbb bdsacw $period $if,r
policyo
* significance of the turning point
qui reg bdgdpg lnetoda_gdp lnetoda_gdp2 $bd policy_oldper $period $if,r
scalar turnpt = -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2])
nlcom -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg bdgdpg l.(netoda_gdp netoda_gdp2) $bd policy_oldper $period $if,r
qui sum l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg bdgdpg l.(netoda_gdp netoda_gdp2) $bd policy_oldper $period $if,r
* joint significance at the mean value of aid
lincom _b[l.netoda_gdp]*`muaid'+_b[l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*7
* significance of the turning point
qui reg d.bdgdpg dlnetoda_gdp dlnetoda_gdp2 d.($bd policy_oldper) $period $if,r
scalar turnpt = -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2])
nlcom -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(bdgdpg l.netoda_gdp l.netoda_gdp2 $bd policy_oldper)  $period $if,r
qui sum d.l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg d.(bdgdpg l.netoda_gdp l.netoda_gdp2 $bd policy_oldper)  $period $if,r
lincom _b[d.l.netoda_gdp]*`muaid'+_b[d.l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*8
* significance of the turning point
qui ivreg2 d.bdgdpg (d.bdlgdp=d.l.bdlgdp) dlnetoda_gdp dlnetoda_gdp2 d.(bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 policy_oldper) $period $if, r ffirst
scalar turnpt = -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2])
nlcom -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.bdgdpg (d.bdlgdp=d.l.bdlgdp) d.(l.netoda_gdp l.netoda_gdp2 bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 policy_oldper) $period $if, r ffirst
qui sum d.l.netoda_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.bdgdpg (d.bdlgdp=d.l.bdlgdp) d.(l.netoda_gdp l.netoda_gdp2 bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 policy_oldper) $period $if, r ffirst
lincom _b[d.l.netoda_gdp]*`muaid'+_b[d.l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*9
qui reg bdgdpg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd bdbb bdinfl bdsacw $period $if,r
policyo
* significance of the turning point
qui reg bdgdpg learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 $bd policy_oldper $period $if,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg bdgdpg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd policy_oldper $period $if,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg bdgdpg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd policy_oldper $period $if,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*10
* significance of the turning point
qui reg d.bdgdpg dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.($bd policy_oldper) $period $if,r
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(bdgdpg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $bd policy_oldper) $period $if,r
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg d.(bdgdpg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $bd policy_oldper) $period $if,r
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*11
* significance of the turning point
qui ivreg2 d.bdgdpg (d.bdlgdp=d.l.bdlgdp) dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.(bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 policy_oldper) $period $if, r ffirst
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.bdgdpg (d.bdlgdp=d.l.bdlgdp) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 policy_oldper) $period $if, r ffirst
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.bdgdpg (d.bdlgdp=d.l.bdlgdp) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 bdethnf bdassas bdethnfassas bdssa bdeasia bdicrge bdm21 policy_oldper) $period $if, r ffirst
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


******************************
***2. Extended Years Sample***
******************************
global out outreg2 using "$OUT/Table_7", rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
global if if bdsamp==1 & periodst>=1970
scalar deltapval=0
scalar turnpt=0

//OLS
use "$DATA/fouryr_final_pub",clear

cap rename policy_newper _policy_newper
cap rename policy_oldper _policy_oldper

tsset ccode period
aidstat

gen lnetoda_gdp = l.netoda_gdp
gen lnetoda_gdp2 = l.netoda_gdp2
gen dlnetoda_gdp = d.l.netoda_gdp
gen dlnetoda_gdp2 = d.l.netoda_gdp2
gen learlyaidC_gdp = l.earlyaidC_gdp
gen learlyaidC_gdp2 = l.earlyaidC_gdp2
gen dlearlyaidC_gdp = d.l.earlyaidC_gdp
gen dlearlyaidC_gdp2 = d.l.earlyaidC_gdp2
gen lrepay_gdp = l.repay_gdp
gen lrepay_gdp2 = l.repay_gdp2
gen dlrepay_gdp = d.l.repay_gdp
gen dlrepay_gdp2 = d.l.repay_gdp2

global bd gdppc62_0 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 
global period _Iperiod_3 _Iperiod_4 _Iperiod_5 _Iperiod_6 _Iperiod_7 _Iperiod_8 _Iperiod_9 _Iperiod_10

*1
qui reg gdppcg l.netoda_gdp $bd lninfl open_ww2 bbfinal $period $if,r
policyn
qui reg gdppcg netoda_gdp $bd policy_newper $period $if & e(sample),r
$out replace

*2
qui reg gdppcg l.netoda_gdp $bd policy_newper $period $if,r
$out append

*3
qui reg d.(gdppcg l.netoda_gdp $bd policy_newper) $period $if,r
qui reg gdppcg netoda_gdp $bd policy_newper $period $if & e(sample),r
$out append

*4
qui reg d.(gdppcg l.netoda_gdp $bd policy_newper) $period $if,r
$out append

*5
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) d.(l.netoda_gdp ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
$out append

*6
qui reg gdppcg l.(netoda_gdp netoda_gdp2) $bd lninfl bbfinal open_ww2 $period $if,r
policyn
* significance of the turning point
qui reg gdppcg lnetoda_gdp lnetoda_gdp2 $bd policy_newper $period $if,r
scalar turnpt = -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2])
nlcom -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg l.(netoda_gdp netoda_gdp2) $bd policy_newper $period $if,r
qui sum l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg l.(netoda_gdp netoda_gdp2) $bd policy_newper $period $if,r
lincom _b[l.netoda_gdp]*`muaid'+_b[l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*7
* significance of the turning point
qui reg d.gdppcg dlnetoda_gdp dlnetoda_gdp2 d.($bd policy_newper) $period $if,r
scalar turnpt = -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2])
nlcom -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gdppcg l.netoda_gdp l.netoda_gdp2 $bd policy_newper) $period $if,r
qui sum d.l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg d.(gdppcg l.netoda_gdp l.netoda_gdp2 $bd policy_newper) $period $if,r
lincom _b[d.l.netoda_gdp]*`muaid'+_b[d.l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

// NONPARAMETRIC PLOT
*drop y_partial x_partial se_p high low ctryper
reg d.(gdppcg $bd policy_newper) $period $if,r
predict y_partial
reg d.(l.netoda_gdp  $bd policy_newper) $period $if,r
predict x_partial
egen ctryper=concat(country period)
scatter y_partial x_partial, mlabel(ctryper) mlabpos(0) msymbol(i) mlabcolor(gs7) mlabsize(tiny) ///
	xtitle("Aid/GDP | X") ytitle("Growth | X") title("") scheme(s1manual)
graph save "$OUT/Figure1", replace
graph export "$OUT/Figure1.eps", replace

*8
* significance of the turning point
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) dlnetoda_gdp dlnetoda_gdp2 d.(ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
scalar turnpt = -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2])
nlcom -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) d.(l.netoda_gdp l.netoda_gdp2 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
qui sum d.l.netoda_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) d.(l.netoda_gdp l.netoda_gdp2 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
lincom _b[d.l.netoda_gdp]*`muaid'+_b[d.l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*9
qui reg gdppcg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd lninfl bbfinal open_ww2 $period $if,r
policyn
* significance of the turning point
qui reg gdppcg learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 d.($bd policy_newper) $period $if,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd policy_newper $period $if,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd policy_newper $period $if,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*10
* significance of the turning point
qui reg gdppcg dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.($bd policy_newper) $period $if,r
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gdppcg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $bd policy_newper) $period $if,r
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg d.(gdppcg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $bd policy_newper) $period $if,r
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*11
* significance of the turning point
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.(ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


**************************************************************Rajan & Subramanian: TABLE 8/9**************************************************************

global out outreg2 using "$OUT/Table_8", rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
scalar deltaSE=0
scalar turnpt=0

******************************
***1. Original Years Sample***
******************************
//OLS
use "$DATA/fiveyr_final_pub", clear
tsset ccode period
aidstat
gen aid_gdp2=aid_gdp^2

gen laid_gdp = l.aid_gdp
gen laid_gdp2 = l.aid_gdp2
gen dlaid_gdp = d.l.aid_gdp
gen dlaid_gdp2 = d.l.aid_gdp2
gen learlyaidC_gdp = l.earlyaidC_gdp
gen learlyaidC_gdp2 = l.earlyaidC_gdp2
gen dlearlyaidC_gdp = d.l.earlyaidC_gdp
gen dlearlyaidC_gdp2 = d.l.earlyaidC_gdp2
gen lrepay_gdp = l.repay_gdp
gen lrepay_gdp2 = l.repay_gdp2
gen dlrepay_gdp = d.l.repay_gdp
gen dlrepay_gdp2 = d.l.repay_gdp2

global rs yc_penn le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac
global period _Iperiod_5 _Iperiod_6 _Iperiod_7 _Iperiod_8
global ifd if rssamp_ab==1 & periodst>=1981 & periodst<=1996
global ifl if rssamp_bb==1 & periodst>=1981 & periodst<=1996

***SUMMARY STATS***
log using "$OUT/sumstats",text append
tabstat aid_gdp rgdpchg if periodst>=1981 & periodst<=1996 & rssamp_bb, stat(N mean median sd min max)
tabstat aid_gdp gdppcg62 if periodst>=1971 & periodst<=2001 & rssamp_bb & RSsamp62, stat(N mean median sd min max)
log c

*1
qui reg rgdpchg l.aid_gdp $rs $period $ifl, r
qui reg rgdpchg aid_gdp $rs $period if e(sample), r
$out replace

*2
qui reg rgdpchg l.aid_gdp $rs $period $ifl, r
$out append

*3
qui reg d.(rgdpchg l.aid_gdp $rs) $period $ifd, r
qui reg rgdpchg aid_gdp $rs $period if e(sample), r
$out append

*4
qui reg d.(rgdpchg l.aid_gdp $rs) $period $ifd, r
$out append

*5
qui ivreg2 d.rgdpchg (d.yc_penn=d.l.yc_penn) d.(l.aid_gdp le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac) $period $ifd, r ffirst
$out append

*6
* significance of the turning point
qui reg rgdpchg laid_gdp laid_gdp2 $rs $period $ifl,r
scalar turnpt = -_b[laid_gdp]/(2*_b[laid_gdp2])
nlcom -_b[laid_gdp]/(2*_b[laid_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg rgdpchg l.aid_gdp l.aid_gdp2  $rs $period $ifl, r
qui sum l.aid_gdp if e(sample)
local muaid=r(mean)
qui reg rgdpchg l.aid_gdp l.aid_gdp2  $rs $period $ifl, r
lincom _b[l.aid_gdp]*`muaid'+_b[l.aid_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*7
* significance of the turning point
qui reg d.rgdpchg dlaid_gdp dlaid_gdp2 $rs $period $ifd,r
scalar turnpt = -_b[dlaid_gdp]/(2*_b[dlaid_gdp2])
nlcom -_b[dlaid_gdp]/(2*_b[dlaid_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(rgdpchg l.aid_gdp l.aid_gdp2 $rs) $period $ifd, r
qui sum d.l.aid_gdp if e(sample)
local muaid=r(mean)
qui reg d.(rgdpchg l.aid_gdp l.aid_gdp2 $rs) $period $ifd, r
lincom _b[d.l.aid_gdp]*`muaid'+_b[d.l.aid_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*8
* significance of the turning point
qui ivreg2 d.rgdpchg (d.yc_penn=d.l.yc_penn) dlaid_gdp dlaid_gdp2 d.(le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac) $period $ifd, r ffirst
scalar turnpt = -_b[dlaid_gdp]/(2*_b[dlaid_gdp2])
testnl -_b[dlaid_gdp]/(2*_b[dlaid_gdp2]) = 0 
scalar deltapval = r(p)
qui ivreg2 d.rgdpchg (d.yc_penn=d.l.yc_penn) d.(l.aid_gdp l.aid_gdp2 le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac) $period $ifd, r ffirst
qui sum d.l.aid_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.rgdpchg (d.yc_penn=d.l.yc_penn) d.(l.aid_gdp l.aid_gdp2 le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac) $period $ifd, r ffirst
lincom _b[d.l.aid_gdp]*`muaid'+_b[d.l.aid_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*9
* significance of the turning point
qui reg rgdpchg learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 $rs $period $ifl,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg rgdpchg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $ifl,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg rgdpchg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $ifl,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*10
* significance of the turning point
qui reg d.rgdpchg dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.($rs) $period $ifd,r
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(rgdpchg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $rs) $period $ifd,r
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg d.(rgdpchg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $rs) $period $ifd,r
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*11
* significance of the turning point
qui ivreg2 d.rgdpchg (d.yc_penn=d.l.yc_penn) dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.(le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac) $period $ifd, r ffirst
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.rgdpchg (d.yc_penn=d.l.yc_penn) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac) $period $ifd, r ffirst
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.rgdpchg (d.yc_penn=d.l.yc_penn) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 le_wdi sw1_i INST_QLTY linf1 M2_GDP_ES BB_GDP_WDI revol safrica east geog6099 ethfrac) $period $ifd, r ffirst
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


******************************
***2. Extended Years Sample***
******************************

gen lnetoda_gdp = l.netoda_gdp
gen lnetoda_gdp2 = l.netoda_gdp2
gen dlnetoda_gdp = d.l.netoda_gdp
gen dlnetoda_gdp2 = d.l.netoda_gdp2

drop if periodst==1961

global out outreg2 using "$OUT/Table_9", rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
scalar deltaSE=0
scalar turnpt=0

global rs gdppc62_0 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac
global period _Iperiod_2 _Iperiod_3 _Iperiod_4 _Iperiod_5 _Iperiod_6 _Iperiod_7 _Iperiod_8 _Iperiod_9 
global ifd if rssamp_ab==1 & RSsamp62==1 & periodst>=1971
global ifl if rssamp_bb==1 & RSsamp62==1 & periodst>=1971

//OLS

*1
qui reg gdppcg62 l.netoda_gdp $rs $period $ifl, r
qui reg gdppcg62 netoda_gdp $rs $period if e(sample), r
$out replace

*2
qui reg gdppcg62 l.netoda_gdp $rs $period $ifl, r
$out append

*3
qui reg d.(gdppcg62 l.netoda_gdp $rs) $period $ifd, r
qui reg gdppcg62 netoda_gdp $rs $period if e(sample), r
$out append

*4
qui reg d.(gdppcg62 l.netoda_gdp $rs) $period $ifd, r
$out append

*5
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) d.(l.netoda_gdp life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
$out append

*6
* significance of the turning point
qui reg gdppcg62 lnetoda_gdp lnetoda_gdp2  $rs $period $ifl, r
scalar turnpt = -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2])
nlcom -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg62 l.netoda_gdp l.netoda_gdp2  $rs $period $ifl, r
qui sum l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg62 l.netoda_gdp l.netoda_gdp2  $rs $period $ifl, r
lincom _b[l.netoda_gdp]*`muaid'+_b[l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*7
* significance of the turning point
qui reg d.gdppcg62 dlnetoda_gdp dlnetoda_gdp2 d.($rs) $period $ifl, r
scalar turnpt = -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2])
nlcom -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gdppcg62  l.netoda_gdp l.netoda_gdp2 $rs) $period $ifd, r
qui sum d.l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg d.(gdppcg62  l.netoda_gdp l.netoda_gdp2 $rs) $period $ifd, r
lincom _b[d.l.netoda_gdp]*`muaid'+_b[d.l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*8
* significance of the turning point
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) dlnetoda_gdp dlnetoda_gdp2 d.(life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
scalar turnpt = -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2])
testnl -_b[dlnetoda_gdp]/(2*_b[dlnetoda_gdp2]) = 0 
scalar deltapval = r(p)
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) d.(l.netoda_gdp l.netoda_gdp2 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
qui sum d.l.netoda_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) d.(l.netoda_gdp l.netoda_gdp2 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
lincom _b[d.l.netoda_gdp]*`muaid'+_b[d.l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*9
* significance of the turning point
qui reg gdppcg62 learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 $rs $period $ifl,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $ifl,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $ifl,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*10
* significance of the turning point
qui reg d.gdppcg62 dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.($rs) $period $ifl,r
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gdppcg62  l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $rs) $period $ifd,r
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg d.(gdppcg62  l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $rs) $period $ifd,r
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*11
* significance of the turning point
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.(life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


**************************************************************Robustness Checks: TABLE 10/11**************************************************************

**********************************
*(5) & (6) Robustness I***********
**********************************

global out outreg2 using "$OUT/Table_10", rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
scalar deltaSE=0
scalar turnpt=0

use "$DATA/fiveyr_final_pub",clear
aidstat
tsset ccode period

gen lnetoda_gdp = l.netoda_gdp
gen lnetoda_gdp2 = l.netoda_gdp2
gen dlnetoda_gdp = d.l.netoda_gdp
gen dlnetoda_gdp2 = d.l.netoda_gdp2
gen learlyaidC_gdp = l.earlyaidC_gdp
gen learlyaidC_gdp2 = l.earlyaidC_gdp2
gen dlearlyaidC_gdp = d.l.earlyaidC_gdp
gen dlearlyaidC_gdp2 = d.l.earlyaidC_gdp2
gen lrepay_gdp = l.repay_gdp
gen lrepay_gdp2 = l.repay_gdp2
gen dlrepay_gdp = d.l.repay_gdp
gen dlrepay_gdp2 = d.l.repay_gdp2

**********************
*******Table 10*******
**********************

global rs gdppc62_0 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac
global period _Iperiod_2 _Iperiod_3 _Iperiod_4 _Iperiod_5 _Iperiod_6 _Iperiod_7 _Iperiod_8 _Iperiod_9 
global if if rssamp_bb==1 & RSsamp62==1 & periodst>=1971

*1 
qui reg gdppcg62 lnetoda_gdp lnetoda_gdp2 $rs $period $if,r
scalar turnpt = -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2])
nlcom -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg62 l.(netoda_gdp netoda_gdp2) $rs $period $if,r
qui sum l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg62 l.netoda_gdp l.netoda_gdp2  $rs $period $if, r
lincom _b[l.netoda_gdp]*`muaid'+_b[l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out replace

*2
qui reg gdppcg62 lnetoda_gdp lnetoda_gdp2 l2.gdppcg62 $rs $period $if,r
scalar turnpt = -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2])
nlcom -_b[lnetoda_gdp]/(2*_b[lnetoda_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg62 l.(netoda_gdp netoda_gdp2) l2.gdppcg62 $rs $period $if,r
qui sum l.netoda_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg62 l.netoda_gdp l.netoda_gdp2 l2.gdppcg62 $rs $period $if, r
lincom _b[l.netoda_gdp]*`muaid'+_b[l.netoda_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*3
qui reg gdppcg62 learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 $rs $period $if,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $if,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $if,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*4
qui reg gdppcg62 learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 l2.gdppcg62 $rs $period $if,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) l2.gdppcg62 $rs $period $if,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) l2.gdppcg62 $rs $period $if,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


************************************
***EARLY IMPACT COMMITMENTS PROXY***
************************************
global out outreg2 using "$OUT/Table_11",  rdec(3) adec(3) bdec(3) addstat("R-squared",  e(r2), "Turning point", turnpt, "Turning point SE", deltaSE, "Cragg-Donald F-stat", e(cdf), "Kleibergen-Paap F-Stat", e(widstat), "KP LM Stat (p-value)", e(idp)) excel
scalar deltaSE=0
scalar turnpt=0

**BURNSIDE & DOLLAR**
use "$DATA/fouryr_final_pub",clear

cap rename policy_newper _policy_newper
cap rename policy_oldper _policy_oldper

tsset ccode period
aidstatnoest

gen lnetoda_gdp = l.netoda_gdp
gen lnetoda_gdp2 = l.netoda_gdp2
gen dlnetoda_gdp = d.l.netoda_gdp
gen dlnetoda_gdp2 = d.l.netoda_gdp2
gen learlyaidC_gdp = l.earlyaidC_gdp
gen learlyaidC_gdp2 = l.earlyaidC_gdp2
gen dlearlyaidC_gdp = d.l.earlyaidC_gdp
gen dlearlyaidC_gdp2 = d.l.earlyaidC_gdp2
gen lrepay_gdp = l.repay_gdp
gen lrepay_gdp2 = l.repay_gdp2
gen dlrepay_gdp = d.l.repay_gdp
gen dlrepay_gdp2 = d.l.repay_gdp2

global if if bdsamp==1 & periodst>=1970
global bd gdppc62_0 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 
global period _Iperiod_3 _Iperiod_4 _Iperiod_5 _Iperiod_6 _Iperiod_7 _Iperiod_8 _Iperiod_9 _Iperiod_10

*1
qui reg gdppcg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd lninfl bbfinal open_ww2 $period $if,r
policyn
qui reg gdppcg learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 $bd policy_newper $period $if,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd policy_newper $period $if,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $bd policy_newper $period $if,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out replace

*2
qui reg d.gdppcg dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.($bd policy_newper) $period $if,r
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gdppcg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $bd policy_newper) $period $if,r
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg d.(gdppcg l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $bd policy_newper) $period $if,r
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*3
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.(ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.gdppcg (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 ethnofrac assassinations ethnicXassass_post ssa easia institution0 m2finall1 policy_newper) $period $if, r ffirst
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

**RAJAN & SUBRAMANIAN**

use "$DATA/fiveyr_final_pub",clear
tsset ccode period
aidstatnoest

gen lnetoda_gdp = l.netoda_gdp
gen lnetoda_gdp2 = l.netoda_gdp2
gen dlnetoda_gdp = d.l.netoda_gdp
gen dlnetoda_gdp2 = d.l.netoda_gdp2
gen learlyaidC_gdp = l.earlyaidC_gdp
gen learlyaidC_gdp2 = l.earlyaidC_gdp2
gen dlearlyaidC_gdp = d.l.earlyaidC_gdp
gen dlearlyaidC_gdp2 = d.l.earlyaidC_gdp2
gen lrepay_gdp = l.repay_gdp
gen lrepay_gdp2 = l.repay_gdp2
gen dlrepay_gdp = d.l.repay_gdp
gen dlrepay_gdp2 = d.l.repay_gdp2

global ifd if rssamp_ab==1 & RSsamp62==1 & periodst>=1971
global ifl if rssamp_bb==1 & RSsamp62==1 & periodst>=1971
global rs gdppc62_0 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac
global period _Iperiod_2 _Iperiod_3 _Iperiod_4 _Iperiod_5 _Iperiod_6 _Iperiod_7 _Iperiod_8 _Iperiod_9 

*4
qui reg gdppcg62 learlyaidC_gdp learlyaidC_gdp2 lrepay_gdp lrepay_gdp2 $rs $period $ifl,r
scalar turnpt = -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2])
nlcom -_b[learlyaidC_gdp]/(2*_b[learlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $ifl,r
qui sum l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg gdppcg62 l.(earlyaidC_gdp earlyaidC_gdp2 repay_gdp repay_gdp2) $rs $period $ifl,r
lincom _b[l.earlyaidC_gdp]*`muaid'+_b[l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*5
qui reg d.gdppcg62 dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.($rs) $period $ifd,r
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui reg d.(gdppcg62  l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $rs) $period $ifd,r
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui reg d.(gdppcg62  l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 $rs) $period $ifd,r
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append

*6
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) dlearlyaidC_gdp dlearlyaidC_gdp2 dlrepay_gdp dlrepay_gdp2 d.(life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
scalar turnpt = -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2])
nlcom -_b[dlearlyaidC_gdp]/(2*_b[dlearlyaidC_gdp2]), level(90)
matrix SE = r(V)
scalar deltaSE = sqrt(SE[1,1])
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
qui sum d.l.earlyaidC_gdp if e(sample)
local muaid=r(mean)
qui ivreg2 d.gdppcg62 (d.gdppc62_0=d.l.gdppc62_0) d.(l.earlyaidC_gdp l.earlyaidC_gdp2 l.repay_gdp l.repay_gdp2 life0 open_ww2_0 institution0 lninfl m2final bbfinal revolutions ssa easia geog6099 ethnofrac) $period $ifd, r ffirst
lincom _b[d.l.earlyaidC_gdp]*`muaid'+_b[d.l.earlyaidC_gdp2]*(`muaid'*`muaid')
scalar pval=2*ttail(e(N)-e(df_m),abs(r(estimate)/r(se)))
$out append


